package com.hdax.dm.Controller.list;

import com.hdax.dm.dto.list.querygoodsinfosDto;
import com.hdax.dm.service.itemSearchService;
import com.hdax.dm.utils.response.CommonResponse;
import com.hdax.dm.utils.response.ResponseUtil;
import com.hdax.dm.vo.itemSearchVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@RequestMapping("/item")
public class querygoodsinfosController {

    @Autowired
    private itemSearchService itemSearchService;

    /**
     * 搜索界面：根据城市、一级分类、二级分类查询商品信息
     */
    @PostMapping("list/querygoodsinfos")
    public CommonResponse<querygoodsinfosDto> querygoodsinfos(@RequestBody itemSearchVo vo) throws IOException {
        return ResponseUtil.returnSuccess(itemSearchService.itemSearch(vo));
    }
}
